package com.xing.stream;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Author: linjx
 * Date: 2019/6/2
 */
public class StreamMain {


    public static void main(String[] args) {
        List<Integer> intList = Arrays.asList(1, 2, 3, 4, 5);

        Function<List<Integer>, List<String>> fun =
                (List<Integer> il) -> il.stream().map(String::valueOf).collect(Collectors.toList());

        System.out.println(StreamFn.of(fun).listOn(Collections.singleton(intList)));
        System.out.println(StreamFn.of(fun).first(Collections.singleton(intList)).get());
        System.out.println(StreamFn.of(fun).apply(Stream.of(intList)).findFirst().get());
    }
}
